import axios from "axios";

const url = 'http://localhost:11434/api/generate';
const headers = {
  'Content-Type': 'application/json',
};

export async function getCron(messages) {
  
  
  const data = {
    "model": "qwen2.5",
    "prompt":'"' + messages + '"找出这句话中的星期和时间段，星期日为0，星期一为1，星期二为2，星期三为3，星期四为4，星期五为5，星期六为6，'+
             "只返回json格式，格式如下：{dates:[{week:0,range_time:'18:00 - 20:00'}]}",
    "format": "json",
    "stream": false
  }
  try {
    const response = await axios.post(url, data, { headers });
    return JSON.parse(response.data.response);
  } catch (error) {
    console.error(error);
    throw error; 
  }
}

